Problem solving for programmers

MOC Programming

Created: 2022-07-13
Tags: #fleeting


Learning language syntax only teaches you how to write
It's like grammar. It doesn't teach you what to write, or why.

EVERYONE STARTS FROM THE BOTTOM.
Nobody is born solving complex problems. Like any skill, problem-solving is developed.

Many think that being a better problem solver means solving more problems faster
But no,
It's about being able to find the best solutiont of a problem and making that solution a reality.

Doing programming is basically
thinking about the problem and solve it in an elegant manner
or
you could just lazily program and debug all the way.

In a Nutshell, Problem Solving in Programmig

First -> we understand how a human solves the problem.
Then -> understand how to translate that into an algorithm that a computer can do
Finally -> writing the specific syntax (the languange we communicate to the computer)

Encapsulation

IF -> professor instructs a human to "Get me a cup of coffee"
THEN -> humans uses encapsulation to instantly know how to do the steps.
However, the actual real number of steps to get the coffee are

  • getting up, walking down the hall, getting in your car, sitting down inside of your car, knowing the instructions to where the coffee stand is, knowing when to start the car, knowing when to stop the car,
  • driving to a coffee stand, paying for the coffee,
  • getting the change if there is a change etc.. etc..
  • then knowing when we got the coffee, then knowing the route back to the office, then driving their, then going back to your boss office, if boss is not there, then find him, if he is there, then hand the coffee to boss, and so on....

Abstraction

Continuing the encapsulation of "Get me a cup of coffee"
We then ask for the details of the coffee itself
Abstraction in programming basically ignores small unimportant details of an object and only remember few important items

However, if we take a way the abstraction, which computers do
Computers will ask for

  • Will it be a mug of coffee or in a styrofoam one?
  • Freshly Brewed, or concentrated?
  • Does it come from Africa or America?
  • How sweet should the coffee be?
  • Should the coffee use sugar or sweetener?
  • Does the coffee need to be hot or cold?
  • and more more more questions